﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using uMES.LeanManufacturing.ReportBusiness;
using Newtonsoft.Json;

public partial class uMESTeamProductionKanBanForm1 : System.Web.UI.Page
{
    public string TeamID = "";
    public string FactoryName = "";
    public string IP = "";
    public string Team = "[]";
    private uMESCommonBusiness common = new uMESCommonBusiness();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["teamid"] != null)
            {
                TeamID = Request.QueryString["teamid"].ToString().Trim();
                DataTable dt = common.GetTeamNamesByTeamID(TeamID);
                if (dt.Rows.Count > 0)
                {
                    FactoryName = dt.Rows[0]["fName"].ToString();
                }
                DataTable dtTeam = common.GetTeamByFactoryId(dt.Rows[0]["factoryid"].ToString());
                List<Dictionary<string, string>> paras = new List<Dictionary<string, string>>();
                for (int i = 0; i < dtTeam.Rows.Count; i++)
                {
                    Dictionary<string, string> para = new Dictionary<string, string>();
                    para.Add("TEAMID", dtTeam.Rows[i]["TEAMID"].ToString());
                    para.Add("TEAMNAME", dtTeam.Rows[i]["TEAMNAME"].ToString());
                    paras.Add(para);
                }
                Team = JsonConvert.SerializeObject(paras);
                IP = common.GetIpAddress(); ;
            }
        }
    }
}